// Package model
// @Author zhongxc
// @Date 2024/7/9 15:28:00
// @Desc
package model

import "vben-common/datatypes"

type MenuType int32

const (
	// MenuTypeDir 目录
	MenuTypeDir MenuType = 0
	// MenuTypeMenu 菜单
	MenuTypeMenu MenuType = 1
	// MenuTypeButton 按钮
	MenuTypeButton MenuType = 2
)

type MenuModel struct {
	BaseModel[MenuModel]
	Id        int64          `gorm:"primaryKey" form:"id" json:"id"`
	ParentId  int64          `gorm:"column:parent_id" form:"parent_id" json:"parent_id"`
	Name      string         `gorm:"column:name" form:"name" json:"name"`
	Url       string         `gorm:"column:url" form:"url" json:"url"`
	Perms     string         `gorm:"column:perms" form:"perms" json:"perms"`
	Type      MenuType       `gorm:"column:type" form:"type" json:"type"`
	Icon      string         `gorm:"column:icon" form:"icon" json:"icon"`
	OrderNo   int64          `gorm:"column:order_no;default:0" form:"order_no" json:"order_no"`
	Status    int8           `gorm:"column:status" form:"status" json:"status"`
	CreatedBy string         `gorm:"column:created_by" form:"created_by" json:"created_by"`
	CreatedAt datatypes.Time `gorm:"column:created_at" form:"createdAt" json:"Created_at"`
	UpdatedBy string         `gorm:"column:updated_by" form:"updated_by" json:"updated_by"`
	UpdatedAt datatypes.Time `gorm:"column:updated_at;type:datetime;default:NULL" form:"updated_at" json:"updated_at" time_format:"2006-01-02" time_utc:"1"`
	Deleted   int8           `gorm:"column:deleted" form:"deleted" json:"deleted"`
	DeletedAt datatypes.Time `gorm:"column:deleted_at" form:"deleted_at" json:"deleted_at"`
	Component string         `gorm:"column:component" form:"component" json:"component"`
}

func NewMenuModel() *MenuModel {
	return &MenuModel{}
}

func (m *MenuModel) TableName() string {
	return "sys_menu"
}
